<template>
  <div class="container">
    <div class="thumbnail">
      <img src="../assets/ic_female_medical.png" alt="...">
      <div class="caption text-center">
        <h3>{{message1}}</h3>
      </div>
    </div>
    <ul class="list-group">
      <a @click="joinVip" class="list-group-item text-center" v-show="isShow"><li class="list-group-item"><span >您还不是会员，点击加入童心会员!</span></li> </a>
    </ul>
    <ul class="list-group">
      <a @click="myOrder" class="list-group-item"><li class="list-group-item">我的问诊（加入会员后显示）<span id="wz_number" class="badge text-right"></span></li> </a>
    </ul>
  </div>
</template>

<script>
  export default {
    name: 'Userinfo',

    data() {
      return {
        message1: '普通用户',
        isShow: true,
      }
    },
    methods: {
      getList: function () {
        var test = window.location.href;
        var attr = test.split("?");
        var att = attr[1].split("&");
        var at = att[0].split("=");
        var a = at[1].split("#");
        localStorage.setItem('Opid', a[0]);
      },
      joinVip() {
        this.$router.push('/Submit');
      },
      myOrder() {
        this.$router.push('/MyOrder');
      },
      isvp() {
        var opid = localStorage.getItem('Opid')
        this.$ajax.get('http://47.75.110.31:8080/userinfo/findByOpid?opid=' + opid)
          .then(response => {
            this.order = response.data
            this.isvip = this.order[0].isvip
            console.log(this.isvip)
            if (this.isvip !== null) {
              this.message1 = '超级会员';
              this.isShow = false;
            }
          })
      }
    },
    created() {
      this.isvp()
    },
    mounted() {
      this.getList()
    }
  }
</script>

<style scoped>

</style>
